'use strict';
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
const n = r => ('type' in r ? c(r) : o(r));
function c(r) {
  switch (r.type) {
    case 'block-scalar': {
      let s = '';
      for (const e of r.props) s += c(e);
      return s + r.source;
    }
    case 'block-map':
    case 'block-seq': {
      let s = '';
      for (const e of r.items) s += o(e);
      return s;
    }
    case 'flow-collection': {
      let s = r.start.source;
      for (const e of r.items) s += o(e);
      for (const e of r.end) s += e.source;
      return s;
    }
    case 'document': {
      let s = o(r);
      if (r.end) for (const e of r.end) s += e.source;
      return s;
    }
    default: {
      let s = r.source;
      if ('end' in r && r.end) for (const e of r.end) s += e.source;
      return s;
    }
  }
}
function o({ start: r, key: s, sep: e, value: i }) {
  let t = '';
  for (const f of r) t += f.source;
  if ((s && (t += c(s)), e)) for (const f of e) t += f.source;
  return i && (t += c(i)), t;
}
exports.stringify = n;
